/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

:host {
    --spectrum-alert-dialog-min-width: var(--spectrum-alert-dialog-minimum-width);
    --spectrum-alert-dialog-max-width: var(--spectrum-alert-dialog-maximum-width);
    --spectrum-alert-dialog-icon-size: var(--spectrum-workflow-icon-size-100);
    --spectrum-alert-dialog-warning-icon-color: var(--spectrum-notice-visual-color);
    --spectrum-alert-dialog-error-icon-color: var(--spectrum-negative-visual-color);
    --spectrum-alert-dialog-title-font-family: var(--spectrum-sans-font-family-stack);
    --spectrum-alert-dialog-title-font-weight: var(--spectrum-heading-sans-serif-font-weight);
    --spectrum-alert-dialog-title-font-style: var(--spectrum-heading-sans-serif-font-style);
    --spectrum-alert-dialog-title-font-size: var(--spectrum-alert-dialog-title-size);
    --spectrum-alert-dialog-title-line-height: var(--spectrum-heading-line-height);
    --spectrum-alert-dialog-title-color: var(--spectrum-heading-color);
    --spectrum-alert-dialog-body-font-family: var(--spectrum-sans-font-family-stack);
    --spectrum-alert-dialog-body-font-weight: var(--spectrum-body-sans-serif-font-weight);
    --spectrum-alert-dialog-body-font-style: var(--spectrum-body-sans-serif-font-style);
    --spectrum-alert-dialog-body-font-size: var(--spectrum-alert-dialog-description-size);
    --spectrum-alert-dialog-body-line-height: var(--spectrum-line-height-100);
    --spectrum-alert-dialog-body-color: var(--spectrum-body-color);
    --spectrum-alert-dialog-title-to-divider: var(--spectrum-spacing-200);
    --spectrum-alert-dialog-divider-to-description: var(--spectrum-spacing-300);
    --spectrum-alert-dialog-title-to-icon: var(--spectrum-spacing-300);
    --mod-buttongroup-justify-content: flex-end;
    box-sizing: border-box;
    inline-size: fit-content;
    min-inline-size: var(--mod-alert-dialog-min-width, var(--spectrum-alert-dialog-min-width));
    max-inline-size: var(--mod-alert-dialog-max-width, var(--spectrum-alert-dialog-max-width));
    max-block-size: inherit;
    padding: var(--mod-alert-dialog-padding, var(--spectrum-alert-dialog-padding));
    outline: none;
    display: flex;
}

.icon {
    inline-size: var(--mod-alert-dialog-icon-size, var(--spectrum-alert-dialog-icon-size));
    block-size: var(--mod-alert-dialog-icon-size, var(--spectrum-alert-dialog-icon-size));
    flex-shrink: 0;
    margin-inline-start: var(--mod-alert-dialog-title-to-icon, var(--spectrum-alert-dialog-title-to-icon));
}

:host([variant="warning"]) {
    --mod-icon-color: var(--mod-alert-dialog-warning-icon-color, var(--spectrum-alert-dialog-warning-icon-color));
}

:host([variant="error"]) {
    --mod-icon-color: var(--mod-alert-dialog-error-icon-color, var(--spectrum-alert-dialog-error-icon-color));
}

.grid {
    display: grid;
}

.header {
    justify-content: space-between;
    align-items: baseline;
    display: flex;
}

::slotted([slot="heading"]) {
    font-family: var(--mod-alert-dialog-title-font-family, var(--spectrum-alert-dialog-title-font-family));
    font-weight: var(--mod-alert-dialog-title-font-weight, var(--spectrum-alert-dialog-title-font-weight));
    font-style: var(--mod-alert-dialog-title-font-style, var(--spectrum-alert-dialog-title-font-style));
    font-size: var(--mod-alert-dialog-title-font-size, var(--spectrum-alert-dialog-title-font-size));
    line-height: var(--mod-alert-dialog-title-line-height, var(--spectrum-alert-dialog-title-line-height));
    color: var(--mod-alert-dialog-title-color, var(--spectrum-alert-dialog-title-color));
    margin: 0;
    margin-block-end: var(--mod-alert-dialog-title-to-divider, var(--spectrum-alert-dialog-title-to-divider));
}

.content {
    font-family: var(--mod-alert-dialog-body-font-family, var(--spectrum-alert-dialog-body-font-family));
    font-weight: var(--mod-alert-dialog-body-font-weight, var(--spectrum-alert-dialog-body-font-weight));
    font-style: var(--mod-alert-dialog-body-font-style, var(--spectrum-alert-dialog-body-font-style));
    font-size: var(--mod-alert-dialog-body-font-size, var(--spectrum-alert-dialog-body-font-size));
    line-height: var(--mod-alert-dialog-body-line-height, var(--spectrum-alert-dialog-body-line-height));
    color: var(--mod-alert-dialog-body-color, var(--spectrum-alert-dialog-body-color));
    -webkit-overflow-scrolling: touch;
    margin: 0;
    margin-block-start: var(--mod-alert-dialog-divider-to-description, var(--spectrum-alert-dialog-divider-to-description));
    margin-block-end: var(--mod-alert-dialog-description-to-buttons, var(--spectrum-alert-dialog-description-to-buttons));
    overflow-y: auto;
}

@media (forced-colors: active) {
    :host {
        border: solid;
    }
}
